import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import { NzModalService } from 'ng-zorro-antd/modal';
import { EmployeeServiceSvr } from '../../../services/employee.service'

@Component({
  selector: 'app-train-manager',
  templateUrl: './train-manager.component.html',
  styleUrls: ['./train-manager.component.less']
})
export class TrainManagerComponent implements OnInit {

  @Output() cancelDetailFileShowModal = new EventEmitter();

  // 增加模态框
  isVisible = false;

  // 表格模拟数据
  listOfData: any = [];

  // 员工ID
  EmpId: string

  constructor(
    private modal: NzModalService,
    private EmployeeSvr: EmployeeServiceSvr
  ) {}

  // 返回上一级
  back(): void {
    this.cancelDetailFileShowModal.emit();
    window.sessionStorage.setItem('index', '-1');
  }

  // 获取所有
  getAll() {
    this.EmployeeSvr.getArchivesByEmpId(this.EmpId).then(res => {
      this.listOfData = res.TrainDtos
    })
  }

  // 获取所有最新消息
  ngOnInit(): void {
    this.EmpId = window.sessionStorage.getItem('sendEnterFilesID')
    this.getAll()
  }
}
